package com.qhhc.hospital.service.impl;

import com.qhhc.hospital.entity.Orders;
import com.qhhc.hospital.mapper.OrdersMapper;
import com.qhhc.hospital.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrdersService implements IOrdersService {
    @Autowired
    OrdersMapper ordersMapper;
    
    @Override
    public int insert(Orders orders) {
        int count = ordersMapper.insertOrders(orders);
        return count;
    }
    
    @Override
    public List<Orders> selectAll() {
        List<Orders> orders = ordersMapper.selectAllOrders();
        return orders;
    }
    
    @Override
    public Orders selectById(Integer oId) {
        Orders orders = ordersMapper.selectOrdersById(oId);
        return orders;
    }
    
    @Override
    public List<Orders> selectByPatientId(Integer pId) {
        List<Orders> orders = ordersMapper.selectOrdersByPatientId(pId);
        return orders;
    }
    
    @Override
    public List<Orders> selectByDoctorId(Integer dId) {
        List<Orders> orders = ordersMapper.selectOrdersByDoctorId(dId);
        return orders;
    }
    
    @Override
    public int update(Orders orders) {
        return ordersMapper.updateOrders(orders);
    }
    
    @Override
    public int delete(Integer oId) {
        return ordersMapper.deleteOrders(oId);
    }
} 